package com.qiku.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qiku.dao.MenuMapper;
import com.qiku.domin.Menu;
import com.qiku.domin.MenuVo;
import com.qiku.domin.PromotionAd;
import com.qiku.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuMapper menuMapper;

    @Override
    public List<Menu> findSubMenuListByPid(int pid) {
        List<Menu> menuList = menuMapper.findSubMenuListByPid(pid);
        return menuList;

    }

    @Override
    public Menu findMenuById(Integer id) {
        Menu menu = menuMapper.findMenuById(id);
        return menu;
    }



    @Override
    public void saveMenu(Menu menu) {
        menu.setCreatedTime(new Date());
        menu.setUpdatedTime(new Date());
        menu.setCreatedBy("admin");
        menu.setUpdatedBy("admin");
        menuMapper.saveMenu(menu);
    }

    @Override
    public void UpdateMenu(Menu menu) {
        menu.setUpdatedTime(new Date());
        menuMapper.UpdateMenu(menu);
    }



}
